home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 201 / DPCS1104.ISO / Full / QuickBooks / QBTutor / Lesson2 / Lesson2.dcr / 00148_red box sliderize.ls < prev    next >
Encoding:
Text File  |  2001-11-19  |  1.7 KB  |  40 lines

  1. property RedBoxSprite, PropLeftEdge, PropTopEdge, PropRightEdge, PropBottomEdge, oldLeft, oldTop, oldRight, oldBottom, BoxMoveCount, spriteNum
  2.  
  3. on getPropertyDescriptionList
  4.   description = [:]
  5.   addProp(description, #RedBoxSprite, [#default: -1, #format: #number, #comment: "Red Box Sprite:"])
  6.   addProp(description, #PropLeftEdge, [#default: -1, #format: #number, #comment: "Left Edge:"])
  7.   addProp(description, #PropTopEdge, [#default: -1, #format: #number, #comment: "Top Edge:"])
  8.   addProp(description, #PropRightEdge, [#default: -1, #format: #number, #comment: "Right Edge:"])
  9.   addProp(description, #PropBottomEdge, [#default: -1, #format: #number, #comment: "Bottom Edge:"])
  10.   return description
  11. end
  12.  
  13. on beginSprite me
  14.   BoxMoveCount = 0
  15.   oldLeft = sprite(RedBoxSprite).left
  16.   oldTop = sprite(RedBoxSprite).top
  17.   oldRight = sprite(RedBoxSprite).right
  18.   oldBottom = sprite(RedBoxSprite).bottom
  19. end
  20.  
  21. on exitFrame me
  22.   steps = 15
  23.   if BoxMoveCount < steps then
  24.     BoxMoveCount = BoxMoveCount + 1
  25.     dLeft = oldLeft + (((1.0 * PropLeftEdge) - oldLeft) / steps * BoxMoveCount)
  26.     dTop = oldTop + (((1.0 * PropTopEdge) - oldTop) / steps * BoxMoveCount)
  27.     dRight = oldRight + (((1.0 * PropRightEdge) - oldRight) / steps * BoxMoveCount)
  28.     dBottom = oldBottom + (((1.0 * PropBottomEdge) - oldBottom) / steps * BoxMoveCount)
  29.     sprite(RedBoxSprite).locH = dLeft
  30.     sprite(RedBoxSprite).locV = dTop
  31.     sprite(RedBoxSprite).width = dRight - dLeft
  32.     sprite(RedBoxSprite).height = dBottom - dTop
  33.   else
  34.     sprite(RedBoxSprite).locH = PropLeftEdge
  35.     sprite(RedBoxSprite).locV = PropTopEdge
  36.     sprite(RedBoxSprite).width = PropRightEdge - PropLeftEdge
  37.     sprite(RedBoxSprite).height = PropBottomEdge - PropTopEdge
  38.   end if
  39. end
  40.